#include <iostream>
#include <stdio.h>
#include <set>
#include <algorithm>
using namespace std;
const int MAXN = 1e5+7;
struct node {
    int x, y;
    int i;
    int ans;
};
node arr[MAXN];
bool cmp1(node a, node b) {
    return a.x < b.x;
}
bool cmp2(node a, node b) {
    return a.i < b.i;
}

int main() {
    int n;
    while (~scanf("%d", &n)) {
        for (int i=0; i<n; ++i) {
            node& t = arr[i];
            scanf("%d %d", &t.x, &t.y);
        }
        sort(arr, arr+n, cmp1);
        set<int, greater<int> > S;
        for (int i=n-1; i>=0; --i) {
            node& t = arr[i];
            S.insert(t.y);
            set<int>::iterator idx = S.find(t.y);
            printf("inx: %d\n", idx);
        }
    }
    return 0;
}
